* Wave 2 cleaning.


*****************************
* Label variables and values
*****************************

use "${raw_data}/climate_raw_wave_2.dta", clear

* Label variables by block

*-------------------
* Eligibility
*-------------------
sum age 
label var age "Age"

tab gender
label var gender "Gender"

tab educ 
label var educ "Education"

tab hh_income
label var hh_income "Household income"

* Country and State variables 
* Run another very long do-file that labels values of state and county

do "${code_folder}/cleaning/county_state_labels.do"

*---------------------
* County and postcode
*---------------------

* County variables


*--------------------
* Knowledge
*--------------------
tab know_heard 
label var know_heard "Heard of global warming before"

tab know_cause
label var know_cause "Global warming human/nature caused"
	
*------------------------
* Climate add. questions
*------------------------

label var trust_science "Trust scientists that work on GW"

label var trust_government "Trust in government"

tab science_consensus 
label var science_consensus "Scientists' consensus on GW"

tab worry
label var worry "Worried about GW"

tab harm
label var harm "GW harms people"	



*------------------------------------------
* Behaviors, Normative Belifs, Punishment
*------------------------------------------

tab fight_gw
label var fight_gw "Fight global warming"
label var fight_gw_norm "Others should fight global warming"
label var fight_gw_punich "Friends criticize someone who does not try to fight global warming"


label var fight_gw_belief_1 "Belief about others - Fight global warming"
label var fight_gw_belief_2 "Belief about others - Other should fight global warming"
label var fight_gw_belief_3 "Belief about others - Friends would criticize someone who does not try to fight global warming"


label var fight_belief_1 "Belief about others - Restrict meat consumption"
label var fight_belief_2 "Belief about others - Avoid taking flights"
label var fight_belief_3 "Belief about others - Use environmentally-friendly alternatives to car"
label var fight_belief_4 "Belief about others - Receive electricity from green sources"
label var fight_belief_5 "Belief about others - Adapt shopping behavior"
label var fight_belief_6 "Belief about others - Politically support fight against GW"

label var fight_norms_1 "Own norms - Restrict meat consumption"
label var fight_norms_2 "Own norms - Avoid taking flights"
label var fight_norms_3 "Own norms - Use environmentally-friendly alternatives to car"
label var fight_norms_4 "Own norms - Receive electricity from green sources"
label var fight_norms_5 "Own norms - Adapt shopping behavior"
label var fight_norms_6 "Own norms - Politically support fight against GW"

label var fight_norms_belief_1 "Belief about other's norms - Restrict meat consumption"
label var fight_norms_belief_2 "Belief about other's norms - Avoid taking flights"
label var fight_norms_belief_3 "Belief about other's norms - Use environmentally-friendly alternatives to car"
label var fight_norms_belief_4 "Belief about other's norms - Receive electricity from green sources"
label var fight_norms_belief_5 "Belief about other's norms - Adapt shopping behavior"
label var fight_norms_belief_6 "Belief about other's norms - Politically support fight against GW"




	
	
*------------------------
* Donation Atmosfair
*------------------------

label var donate_atmosfair "Donation to Atmosfair (out of $450)"	
	
	
*------------------------
* Policy Support
*------------------------

label var support_policy_1 "Fund research into renewable energy"
label var support_policy_2 "Regulate carbon dioxide as a pollutant"
label var support_policy_3 "Set carbox dioxide emission limits"
label var support_policy_4 "Carbon tax"
label var support_policy_5 "Production of at least 20% of eletricity with renewable sources"
label var support_policy_6 "Tax rebates for people who purchase energy-efficient items"

label var support_schools "Schools should teach about GW"

label var support_actions_1 "Vote for candidate that supports GW"
label var support_actions_2 "Display sign about GW"
label var support_actions_3 "Donate money to GW organization"
label var support_actions_4 "Volunteer in GW organization"
label var support_actions_5 "Contact government officials about GW"
label var support_actions_6 "Meet with elected official about GW"
label var support_actions_7 "Support organization engaging in non-violent civil disobedience"
label var support_actions_8 "Engage in non-violent civil disobedience"
label var support_actions_9 "Attend rally/speech/protest"
label var support_actions_10 "Contact the media to express opinion on GW"
label var support_actions_11 "Share info about GW on social media"

*-----------------------------------
* Moral Foundations Questionnaire
*-----------------------------------

label var moral_foundations_1_1 "Someone suffered emotionally"
label var moral_foundations_1_2 "Some people were treated differently than others"
label var moral_foundations_1_3 "Someone's action showed love for her country"
label var moral_foundations_1_4 "Someone showed a lack of respect of authority"
label var moral_foundations_1_5 "Someone violated standards of purity and decency"
label var moral_foundations_1_6 "Someone cared for someone weak or vulerable"
label var moral_foundations_1_7 "Someone acted unfairly"
label var moral_foundations_1_8 "Someone did something to betray her group"
label var moral_foundations_1_9 "Someone conformed to the traditions of society"
label var moral_foundations_1_10 "Soemone did something disgusting"
label var moral_foundations_1_11 "Someone was cruel"
label var moral_foundations_1_12 "Someone was denied her rights"
label var moral_foundations_1_13 "Someone showed lack of loyalty"
label var moral_foundations_1_14 "Action caused chaos or disorder"
label var moral_foundations_1_15 "Someone acted in a way that God would approve of"

label var moral_foundations_2_1 "Compassion for those who are suffering is the most crucial virtue"
label var moral_foundations_2_2 "When the govt. makes laws, the main principle should be ensuring everyone is treated fairly"
label var moral_foundations_2_3 "Proud of country's history"
label var moral_foundations_2_4 "Respect for authority is something children should learn"
label var moral_foundations_2_5 "People shouldn't do things that are disgusting"
label var moral_foundations_2_6 "One of the worst things a person could do is hurt a defenseless animal"
label var moral_foundations_2_7 "Justice is the most important requirement for a society"
label var moral_foundations_2_8 "People should be loyal to their family members"
label var moral_foundations_2_9 "Men and women each have different roles in society"
label var moral_foundations_2_10 "Call some acts wrong on the grounds that they are unnatural"
label var moral_foundations_2_11 "It can never be right to kill a human being"
label var moral_foundations_2_12 "It's morally wrong that rich children inherit a lot of money"
label var moral_foundations_2_13 "It is more important to be a team player than to express oneself"
label var moral_foundations_2_14 "If I were a solider and disagreed with my officer's orders, I would obey anyway"
label var moral_foundations_2_15 "Chastity is an important virtue"


	
	
*--------------------------------------
* GPS measures - Qualitative Questions
*--------------------------------------
tab gps_risk
label var gps_risk "Willingness to take risks"

tab gps_social1
label var gps_social1 "Willingness to give up something today to benefit more in future"

tab gps_social2
label var gps_social2 "Willingness to punish someone who treats the respondent unfairly"

tab gps_social3
label var gps_social3 "Willingness to punish someone who treats other unfairly"

tab gps_social4
label var gps_social4 "Willingness to give to good causes"

tab gps_person1
label var gps_person1 "Willigness to return favors"

tab gps_person2
label var gps_person2 "Revenge after unjust treatment"

tab gps_person3
label var gps_person3 "Assumption that people have only the best intentions"

tab gps_person4
label var gps_person4 "Self-confidence in math skills"

tab gps_person5
label var gps_person5 "Tendency to postpone tasks"


*-------------------------------------------------
* GPS measures - Quantitative Questions - Part I
*-------------------------------------------------

tab GPS27
label var GPS27 "Lottery or $240"
label var GPS28 "Lottery or $120"
label var GPS29 "Lottery or $60"
label var GPS30 "Lottery or $90"
label var GPS31 "Lottery or $105"
label var GPS32 "Lottery or $75"
label var GPS33 "Lottery or $30"
label var GPS34 "Lottery or $45"
label var GPS35 "Lottery or $15"
label var GPS36 "Lottery or $180"
label var GPS37 "Lottery or $150"
label var GPS38 "Lottery or $135"
label var GPS39 "Lottery or $165"
label var GPS40 "Lottery or $210"
label var GPS41 "Lottery or $225"
label var GPS42 "Lottery or $195"
label var GPS43 "Lottery or $360"
label var GPS44 "Lottery or $300"
label var GPS45 "Lottery or $270"
label var GPS46 "Lottery or $285"
label var GPS47 "Lottery or $255"
label var GPS48 "Lottery or $330"
label var GPS49 "Lottery or $345"
label var GPS50 "Lottery or $315"
label var GPS51 "Lottery or $420"
label var GPS52 "Lottery or $390"
label var GPS53 "Lottery or $405"
label var GPS54 "Lottery or $375"
label var GPS55 "Lottery or $450"
label var GPS56 "Lottery or $435"
label var GPS57 "Lottery or $465"

label var GPS58 "Thank you gift to stranger"

label var GPS59 "Donation to good cause (out of $1,600)"


*-------------------------------------------------
* GPS measures - Quantitative Questions - Part II
*-------------------------------------------------

label var GPS60 "$160 today or $246 in 12 months"
label var GPS61 "$160 today or $201 in 12 months"
label var GPS62 "$160 today or $180 in 12 months"
label var GPS63 "$160 today or $170 in 12 months"
label var GPS64 "$160 today or $165 in 12 months"
label var GPS65 "$160 today or $175 in 12 months"
label var GPS66 "$160 today or $190 in 12 months"
label var GPS67 "$160 today or $195 in 12 months"
label var GPS68 "$160 today or $185 in 12 months"
label var GPS69 "$160 today or $223 in 12 months"
label var GPS70 "$160 today or $212 in 12 months"
label var GPS71 "$160 today or $206 in 12 months"
label var GPS72 "$160 today or $217 in 12 months"
label var GPS73 "$160 today or $234 in 12 months"
label var GPS74 "$160 today or $228 in 12 months"
label var GPS75 "$160 today or $240 in 12 months"
label var GPS76 "$160 today or $296 in 12 months"
label var GPS77 "$160 today or $323 in 12 months"
label var GPS78 "$160 today or $309 in 12 months"
label var GPS79 "$160 today or $316 in 12 months"
label var GPS80 "$160 today or $303 in 12 months"
label var GPS81 "$160 today or $336 in 12 months"
label var GPS82 "$160 today or $343 in 12 months"
label var GPS83 "$160 today or $329 in 12 months"
label var GPS84 "$160 today or $270 in 12 months"
label var GPS85 "$160 today or $258 in 12 months"
label var GPS86 "$160 today or $252 in 12 months"
label var GPS87 "$160 today or $264 in 12 months"
label var GPS88 "$160 today or $283 in 12 months"
label var GPS89 "$160 today or $277 in 12 months"
label var GPS90 "$160 today or $290 in 12 months"



*----------------------
* Background
*----------------------

tab children 
label var children "Number of children"

tab party
label var party "Party"

tab job
label var job "Paid Job"

label var religion "Religion"	

*----------------------
* Media
*----------------------

label var media_main "Main source of news"

label var media_tv_print_radio "Source of news - TV, Radio, Newspapers"

label var media_online "Source of news - Internet"

label var trust_info "Trustworthy information"

encode treatment, gen(treat)
drop treatment
rename treat treatment 
label var treatment "Treatment"
	
	
**** Appending datasets eliminates value labels, so I'll be dealing with GPS measures first and only then cleaning the rest of the file 

****************
* GPS measures
****************

* We need to pull the two waves together in order to standardize 
gen wave = 2

tempfile wave2 
save `wave2'

use "${raw_data}/climate_raw_wave_1.dta", clear 
gen wave = 1

append using `wave2'

* Patience staircase 

gen patience_staircase = .
replace patience_staircase = 1 if (GPS82 == 1) & (GPS82 != .)
replace patience_staircase = 2 if (GPS82 == 2) & (GPS82 != .) 

replace patience_staircase = 3 if (GPS83 == 1) & (GPS83 != .)
replace patience_staircase = 4 if (GPS83 == 2) & (GPS83 != .) 

replace patience_staircase = 5 if (GPS79 == 1) & (GPS79 != .)
replace patience_staircase = 6 if (GPS79 == 2) & (GPS79 != .) 

replace patience_staircase = 7 if (GPS80 == 1) & (GPS80 != .)
replace patience_staircase = 8 if (GPS80 == 2) & (GPS80 != .) 

replace patience_staircase = 9 if (GPS90 == 1) & (GPS90 != .)
replace patience_staircase = 10 if (GPS90 == 2) & (GPS90 != .) 

replace patience_staircase = 11 if (GPS89 == 1) & (GPS89 != .)
replace patience_staircase = 12 if (GPS89 == 2) & (GPS89 != .) 

replace patience_staircase = 13 if (GPS87 == 1) & (GPS87 != .)
replace patience_staircase = 14 if (GPS87 == 2) & (GPS87 != .) 

replace patience_staircase = 15 if (GPS86 == 1) & (GPS86 != .)
replace patience_staircase = 16 if (GPS86 == 2) & (GPS86 != .) 

replace patience_staircase = 17 if (GPS75 == 1) & (GPS75 != .)
replace patience_staircase = 18 if (GPS75 == 2) & (GPS75 != .) 

replace patience_staircase = 19 if (GPS74 == 1) & (GPS74 != .)
replace patience_staircase = 20 if (GPS74 == 2) & (GPS74 != .) 

replace patience_staircase = 21 if (GPS72 == 1) & (GPS72 != .)
replace patience_staircase = 22 if (GPS72 == 2) & (GPS72 != .) 

replace patience_staircase = 23 if (GPS71 == 1) & (GPS71 != .)
replace patience_staircase = 24 if (GPS71 == 2) & (GPS71 != .) 

replace patience_staircase = 25 if (GPS67 == 1) & (GPS67 != .)
replace patience_staircase = 26 if (GPS67 == 2) & (GPS67 != .) 

replace patience_staircase = 27 if (GPS68 == 1) & (GPS68 != .)
replace patience_staircase = 28 if (GPS68 == 2) & (GPS68 != .) 

replace patience_staircase = 29 if (GPS65 == 1) & (GPS65 != .)
replace patience_staircase = 30 if (GPS65 == 2) & (GPS65 != .) 

replace patience_staircase = 31 if (GPS64 == 1) & (GPS64 != .)
replace patience_staircase = 32 if (GPS64 == 2) & (GPS64 != .) 

label var patience_staircase "Intertemporal choice sequence"

* Risk staircase

gen risk_staircase = .
replace risk_staircase = 1 if (GPS35 == 1) & (GPS35 != .)
replace risk_staircase = 2 if (GPS35 == 2) & (GPS35 != .) 

replace risk_staircase = 3 if (GPS34 == 1) & (GPS34 != .)
replace risk_staircase = 4 if (GPS34 == 2) & (GPS34 != .) 

replace risk_staircase = 5 if (GPS32 == 1) & (GPS32 != .)
replace risk_staircase = 6 if (GPS32 == 2) & (GPS32 != .) 

replace risk_staircase = 7 if (GPS31 == 1) & (GPS31 != .)
replace risk_staircase = 8 if (GPS31 == 2) & (GPS31 != .) 

replace risk_staircase = 9 if (GPS38 == 1) & (GPS38 != .)
replace risk_staircase = 10 if (GPS38 == 2) & (GPS38 != .) 

replace risk_staircase = 11 if (GPS39 == 1) & (GPS39 != .)
replace risk_staircase = 12 if (GPS39 == 2) & (GPS39 != .) 

replace risk_staircase = 13 if (GPS37 == 1) & (GPS37 != .)
replace risk_staircase = 14 if (GPS37 == 2) & (GPS37 != .) 

replace risk_staircase = 15 if (GPS40 == 1) & (GPS40 != .)
replace risk_staircase = 16 if (GPS40 == 2) & (GPS40 != .) 

replace risk_staircase = 17 if (GPS47 == 1) & (GPS47 != .)
replace risk_staircase = 18 if (GPS47 == 2) & (GPS47 != .) 

replace risk_staircase = 19 if (GPS46 == 1) & (GPS46 != .)
replace risk_staircase = 20 if (GPS46 == 2) & (GPS46 != .) 

replace risk_staircase = 21 if (GPS50 == 1) & (GPS50 != .)
replace risk_staircase = 22 if (GPS50 == 2) & (GPS50 != .) 

replace risk_staircase = 23 if (GPS49 == 1) & (GPS49 != .)
replace risk_staircase = 24 if (GPS49 == 2) & (GPS49 != .) 

replace risk_staircase = 25 if (GPS54 == 1) & (GPS54 != .)
replace risk_staircase = 26 if (GPS54 == 2) & (GPS54 != .) 

replace risk_staircase = 27 if (GPS53 == 1) & (GPS53 != .)
replace risk_staircase = 28 if (GPS53 == 2) & (GPS53 != .) 

replace risk_staircase = 29 if (GPS56 == 1) & (GPS56 != .)
replace risk_staircase = 30 if (GPS56 == 2) & (GPS56 != .) 

replace risk_staircase = 31 if (GPS57 == 1) & (GPS57 != .)
replace risk_staircase = 32 if (GPS57 == 2) & (GPS57 != .) 

label var risk_staircase "Lottery choice sequence"


* Adjust GPS58 

replace GPS58 = 0  if GPS58 == 1
replace GPS58 = 10  if GPS58 == 2
replace GPS58 = 20  if GPS58 == 3
replace GPS58 = 30  if GPS58 == 4
replace GPS58 = 40  if GPS58 == 5
replace GPS58 = 50  if GPS58 == 6
replace GPS58 = 60  if GPS58 == 7


foreach var in patience_staircase gps_social1 risk_staircase gps_risk gps_person1 GPS58 gps_social2 gps_social3 gps_person2 GPS59_4 gps_social4  gps_person3 { 
    
	egen std_`var' = std(`var')
	* drop `var'
	rename `var' raw_`var'
	rename std_`var' `var'
	
}

* Patience score
* 0.712 * Staircase method - patience_staircase 
* 0.288 Self-assessment: willigness to wait - gps_social1

gen patience_score = 0.7115185 * patience_staircase + 0.2884815 * gps_social1
label var patience_score "Patience Score"
egen std_patience_score = std(patience_score)
label var std_patience_score "Standardized Patience Score"
* Risk taking score 
* 0.473 * Staircase method - risk_staircase
* 0.527 Self-assement: willigness to take risks in general - gps_risk
gen risk_taking_score = 0.4729985 * risk_staircase + 0.5270015 * gps_risk
label var risk_taking_score "Risk Taking Score"
egen std_risk_taking_score = std(risk_taking_score)
label var std_risk_taking_score "Standardized Risk Taking Score"

* Positive reciprocity score
* 0.515 * Gift in exchange for help - GPS58
* 0.485 * Willingness to return a favour - gps_person1
gen pos_rec_score = 0.4847038 * gps_person1 + 0.5152962 * GPS58 
label var pos_rec_score "Positive Reciprocity Score"
egen std_pos_rec_score = std(pos_rec_score)
label var std_pos_rec_score "Standardized Positive Reciprocity Score"


* Negative reciprocity score
* 0.374 * Willingness to take revenge - gps_person2
* 0.313 * Willigness to punish unfair behavior toward self - gps_social2
* 0.313 * Willigness to punish after unfair behavior towards others - gps_social3
gen neg_rec_score = 0.6261938/2 * gps_social2 + 0.6261938/2 * gps_social3 + 0.3738062 * gps_person2
label var neg_rec_score "Negative Reciprocity Score"
egen std_neg_rec_score = std(neg_rec_score)
label var std_neg_rec_score "Standardized Negative Reciprocity Score"


* Altruism 
* 0.635 * Donation Decision - GPS59_4
* 0.365 * Willigness to give to good causes - gps_social4
gen altruism_score = 0.6350048 * GPS59_4  + 0.3649952 * gps_social4
label var altruism_score "Altruism Score"
egen std_altruism_score = std(altruism_score)
label var std_altruism_score "Standardized Altruism Score"

* Trust 
* 1 * People have only the best intentions - gps_person3
gen trust_score = gps_person3 
label var trust_score "Trust Score"
egen std_trust_score = std(trust_score)
label var std_trust_score "Standardized Trust Score"


* Just keep observations for wave 2 

keep if wave == 2

* Eliminate variables from wave 1 that don't exist here

 foreach var of varlist _all {
    capture assert mi(`var')
     if !_rc {
       drop `var'
     }
 }

	
	
**********************
*  Label Values
**********************

label define yesno 0 "No" 1 "Yes"
label define gender 1 "Male" 2 "Female" 3 "Other" 
label define educ 1 "Less than high school degree" 2 "High school graduate" ///
				  3 "Some college but no degree" 4 "Associate degree in college" ///
				  5 "Bachelor's degree" 6 "Master's degree" ///
				  7 "Doctoral degree" 8 "Professional degree"
				  
label define income 1 "Less than $10,000" 2 "$10,000 to $19,999" ///
				    3 "$20,000 to $29,999" 4 "$30,000 to $39,999" ///
					5 "$40,000 to $49,999" 6 "$50,000 to $59,999" ///
					7 "$60,000 to $69,999" 8 "$70,000 to $79,999" /// 
					9 "$80,000 to $89,999" 10 "$90,000 to $99,999" ///
					11 "$100,000 to $109,999" 12 "$110,000 to $119,999" /// 
					13 "$120,000 to $129,000" 14 "$130,000 to $139,999" /// 
					15 "$140,000 to $149,999" 16 "$150,000 to $199,999" /// 
					17 "More than $200,000"
					
label define GPS_risk 1 "50/50 chance"	2 "Sure payment"	


label define GPS_patience 1 "Today"	2 "In 12 months"	 


label define know_cause 1 "Result of human activities" 2 "Result of natural causes"
						 
label define trust 1 "A great deal" 2 "A lot" 3 "A moderate amount" ///
						   4 "A little" 5 "None at all"
						   
label define science_consensus 1 "Most scientists think GW is happening" 2 "There is disagreement" 3 "Most scientists think GW is not happening"

label define worry 1 "Very worried" 2 "Somehow worried" 3 "Not very worried" 4 "Not at all worried"						   
						   
label define harm 1 "Not at all" 2 "Only a little" 3 "A moderate amount" 4 "A great deal"					   
						   						   
label define support 1 "Strongly support"	2 "Somewhat support" 3 "Somewhat oppose" 4 "Strongly oppose"	

label define agree 1 "Strongly agree" 2 "Somewhat agree" 3 "Somewhat disagree" 4 "Strongly disagree"

label define likelihood 1 "Definitely would" 2 "Probably would" 3 "Probably would not"	4 "Definitely would not"	  
						   					   						   
label define children 0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "More than 5"

label define party 1 "Republican" 2 "Democratic"	

label define moral_foundations_1 0 "Not at all relevant" 1 "Not very relevant" 2 "Slightly relevant" 3 "Somewhat relevant" 4 "Very relevant" 5 "Extremely relevant"		   
	
label define moral_foundations_2 0 "Strongly disagree" 1 "Moderately disagree" 2 "Slightly disagree" 3 "Slightly agree" 4 "Moderately agree" 5 "Strongly agree"		   

label define job 1 "Yes" 2 "No, but I have had a paid job" 3 "No, I have not had a paid job"		
		
label define media_main 1 "Television" 2 "Radio" 3 "Printed newspapers and magazines" /// 
						4 "News websites" 5 "Social media"
		

label define media_tv_print_radio 1 "Fox News" 2 "Local television news" 3 "CNN" 4 "NBC/MSNBC News" /// 
								  5 "CBS  News" 6 "ABC News" 7 "Regional or local newspapers" /// 
								  8 "Local radio news" 9 "New York Times" 10 "BBC News" 11 "None of the above"

label define media_online 1 "Facebook" 2 "Youtube" 3 "Twitter" 4 "Instagram" 5 "Messaging Apps" ///
						  6 "CNN.com" 7 "Yahoo! News" 8 "NYT online" 9 "Fox News online" /// 
						  10 "HuffPost" 11 "Washington Post online" 12 "Local television news sites online" ///
						  13 "BuzzFeed News" 14 "NBC/MSNBC online" 15 "BCC News online" ///
						  16 "MSN News" 17 "NPR News online" 18 "ABC News online" 19 "CBS News online" /// 
						  20 "Regional or local newspaper website" 21 "USA Today online" 22 "None of the above"
		
		
label define religion 1 "Not important at all" 2 "Not so important" 3 "Important" 4 "Very important"
		
		
label define trust_info 1 "Very trustworthy" 2 "Somewhat trustworthy" 3 "Neither trustworthy nor untrustworthy" ///
						4 "Somewhat untrustworthy" 5 "Very untrustworthy"
		
		
		
* Label value - attribute 
label values trust_info trust_info
label values gender gender
label values educ educ 
label values hh_income income

forval i = 27/57 { 

label values GPS`i' GPS_risk	
	
}

forval i = 60/90 { 

label values GPS`i' GPS_patience	
	
}

label values know_cause know_cause

label values trust_science trust
label values trust_government trust
label values science_consensus science_consensus
label values worry worry
label values harm harm 

label values religion religion
label values children children
label values party party 
label values job job 
label values media_main media_main 

split media_tv_print_radio, parse(,)
drop media_tv_print_radio


forval i = 1/10 { 
	destring media_tv_print_radio`i', replace
	label values media_tv_print_radio`i' media_tv_print_radio
	label var media_tv_print_radio`i' "Source of news - TV, Radio, Newspapers - `i'"
}


split media_online, parse(,)
drop media_online

forval i = 1/21 { 
	destring media_online`i', replace
	label values media_online`i' media_online
	label var media_online`i' "Source of news - Internet - `i'"
}



#delimit ;
local y "know_heard 
fight_gw fight_gw_punich fight_norms_1 fight_norms_2 fight_norms_3 fight_norms_4
fight_norms_5 fight_norms_6  fight_gw_norm";
#delimit cr
	
foreach var of local y {
	label values `var' yesno
	}

	
forval i = 1/6 { 

label values support_policy_`i' support	
	
}

label values support_schools_1 agree
	
forval i = 1/11 { 

label values support_actions_`i' likelihood	
	
}

forval i = 1/15 { 
	label values moral_foundations_1_`i' moral_foundations_1
	label values moral_foundations_2_`i' moral_foundations_2
}





*********************
* Moral Foundations
*********************

* We didn't include screener questions so the numbering doesn't correspond to the original questionnaire
* Adjusting the numbering so that it matches the original 
	
forval i = 6/15 {
scalar add = `i' + 1	
local j = add 
rename moral_foundations_1_`i' moral_foundations_`j'
	
}

forval i = 1/5 { 
	rename moral_foundations_1_`i' moral_foundations_`i'
	
}

forval i = 1/5 {
scalar add = `i' + 16	
local j = add 
rename moral_foundations_2_`i' moral_foundations_`j'
	
}


forval i = 6/15 {
scalar add = `i' + 17
local j = add 
rename moral_foundations_2_`i' moral_foundations_`j'
	
}


* Harm/Care
gen harm_care_score = moral_foundations_1 + moral_foundations_7 + moral_foundations_12 + moral_foundations_17 + moral_foundations_23 + moral_foundations_28
label var harm_care_score "Harm/Care Score"

* Fairness/Reciprocity
gen fairness_score = moral_foundations_2 + moral_foundations_8 + moral_foundations_13 + moral_foundations_18 + moral_foundations_24 + moral_foundations_29
label var fairness_score "Fairness/Reciprocity Score"

* In-group/Loyalty
gen loyalty_score = moral_foundations_3 + moral_foundations_9 + moral_foundations_14 + moral_foundations_19 + moral_foundations_25 + moral_foundations_30
label var loyalty_score "In-group/Loyalty Score"

* Authority/Respect
gen respect_score = moral_foundations_4 + moral_foundations_10 + moral_foundations_15 + moral_foundations_20 + moral_foundations_26 + moral_foundations_31
label var respect_score "Authority/Respect Score"

* Purity/Sanctity
gen purity_score = moral_foundations_5 + moral_foundations_11 + moral_foundations_16 + moral_foundations_21 + moral_foundations_27 + moral_foundations_32
label var purity_score "Purity/Sanctity Score"

* Relative Importance of Universalist Values 
* Universalist Values - Communal Values

gen universalist_values = harm_care_score + fairness_score
label var universalist_values "Universalist Values"
gen communal_values = loyalty_score + respect_score 
label var communal_values "Communal Values"

gen relative_universalist_values = universalist_values - communal_values 
label var relative_universalist_values "Relative Impotance of Universalist Values"

**************************
* Generate Quota Variables 
***************************

gen female = (gender==2|gender==3)
label var female "Female"

gen bachelor_above = (educ == 5 | educ == 6)
label var bachelor_above "Bachelor's degree or above"

gen age_1834 = (age > 17 & age < 35)
label var age_1834 "Age: 18-34"

gen age_3554 = (age > 34 & age < 55)
label var age_3554 "Age: 35-54"

gen age_55 = (age > 54)
label var age_55 "Age: 55+"

gen region_northeast = (state==7|state==20|state==22|state==30|state==40|state==46|state==31|state==33|state==39)
label var region_northeast "Region: Northeast"

gen region_midwest = (state==14|state==15|state==23|state==36|state==50|state==16|state==17|state==24|state==26|state==28|state==35|state==42)
label var region_midwest "Region: Midwest"

gen region_south = (state==8|state==10|state==11|state==21|state==34|state==41|state==47|state==9|state==49|state==1|state==18|state==25|state==43|state==4|state==19|state==37|state==44)
label var region_south "Region: South"

gen region_west = (state==3|state==6|state==13|state==27|state==29|state==32|state==45|state==51|state==2|state==5|state==12|state==38|state==48)
label var region_west "Region: West"

* ------------- Save data ------------------
compress
save "${data_out_folder}/wave_2.dta", replace						   
						   
